package java_DesignPattern.BehavioralPattern.Chain_of_responsibilityPattern;

/**
 * 老板类
 */
public class Boss extends Handler {

    //构造方法
    public Boss() {
        super(Handler.SEVEN, Handler.INF);
    }

    @Override
    public void handleRequest(Leave leave) {
        //如果没有下一个处理器，或者请假天数在处理范围之内
        if (nextHandler != null && leave.getNum() <= Handler.SEVEN ) {
            System.out.println("老板审批：" + leave.getName() + "请假" + leave.getNum() + "天，" + leave.getContent());
        } else {
            System.out.println("请假天数超出范围，无法审批");
        }
    }
}
